export enum RoleTypeEnum {
  '系统角色' = 1,
  '业务角色',
}

export interface ResTreeVO {
  id: number;
  parentId: number;
  name: string;
  children: ResTreeVO[];
}

export interface TreeDataSource {
  label: string;
  key: string;
  children?: TreeDataSource[];
  [key: string]: any;
}

export function createTree(res: ResTreeVO[]): TreeDataSource[] {
  return res.map((t) => ({
    label: t.name,
    key: `${t.id}`,
    children: createTree(t.children),
  }));
}
